home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3188 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: atglab.bls.com!Alun.Champion
  2. From: Alun.Champion@bridge.bst.bls.com (Alun Champion)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Accessing UNIX environment variables with C
  5. Date: 26 Jan 1996 19:50:21 GMT
  6. Organization: Computer People Inc.
  7. Message-ID: <ALUN.CHAMPION.96Jan26145021@g7240065.bridge.bst.bls.com>
  8. References: <4eaqt5$f23@zippy.cais.net> <3108f268.14258749@news.demon.co.uk>
  9. NNTP-Posting-Host: bstfirewall.bst.bls.com
  10. In-reply-to: dave@stsdaveb.demon.co.uk's message of Fri, 26 Jan 1996 15:28:08
  11.     GMT
  12.  
  13. In article <3108f268.14258749@news.demon.co.uk> dave@stsdaveb.demon.co.uk (Dave Thornton) writes:
  14.  
  15. : On 26 Jan 1996 15:10:29 GMT, usaid@cais.cais.com (USAID) wrote:
  16.  
  17. :> Can someone tell me how to use a UNIX environment variable in C?  The 
  18. :> equivalent statement in Perl is the %ENV{VARNAME} statement, where 
  19. :> VARNAME is the environment variable.
  20.  
  21. : I think its the standard ANSI C function  getenv();
  22.  
  23. : /*   Example for getenv  */
  24. [snip]
  25. : void main ()
  26. [snip]
  27.  
  28. Yes, getenv is an ANSI C function but void main() is not an ANSI C program.
  29. main() must be declared
  30.   int main(void)
  31. or
  32.   int main(int argc, char* argv[])
  33.  
  34. Regards
  35.  
  36.   -A.
  37. -- 
  38. | A.Champion                |
  39.